<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
	<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
    <%@page isELIgnored="false" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>审批详情信息</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link id="bootstrap-style" href="<%=basePath%>css/bootstrap.min.css" rel="stylesheet">
	<link href="<%=basePath%>css/bootstrap-responsive.min.css" rel="stylesheet">
	<link id="base-style" href="<%=basePath%>css/style.css" rel="stylesheet">
	<link id="base-style-responsive" href="<%=basePath%>css/style-responsive.css" rel="stylesheet">
	<link href="<%=basePath%>css/index.css" rel="stylesheet">
	<link rel="shortcut icon" href="<%=basePath%>img/favicon.ico">
	<link href="<%=basePath%>css/page.css" rel="stylesheet">
	<link href="<%=basePath%>/css/but.css" rel="stylesheet">
	<script src="<%=basePath%>js/jquery-1.9.1.min.js"></script>
	<script src="<%=basePath%>js/jquery-migrate-1.0.0.min.js"></script>
</head>
 <script type="text/javascript">
 
 function closebutton() {
	 var index = parent.layer.getFrameIndex(window.name);  
 	parent.layer.close(index);  
 }
 function handle(){
     var formData = new FormData($("#frm")[0]);
     $.ajax({  
          url: '<%=basePath%>approve/gotoApprove',
          type: 'POST',  
          data: formData,
          async: false,  
          cache: false,
          contentType: false,  
          processData: false,  
          dataType:"json",
          success: function (result) {
        	  if("ok"==result.date.toString()){
                  alert("审批办理成功");
              }else if("no"==result.date.toString()){
                  alert("审批办理失败");
              }
          }
     });

 }
 </script>
<body>

	<form name="frm" id="frm">
			<input type="hidden" id="docid" name="docid"  value="${maindata.id }">
			<div id="content" class="span10" style="width: 80%;">
				<div class="row-fluid content-table">
					<table class="table table-striped table-bordered bootstrap-datatable">
					  <tbody>
						<tr>
							<td style="width:30%; text-align:right;">标题：</td>
							<td style="text-align:left;">${maindata.title }</td>
						</tr>
						<tr>
							<td style="width:30%; text-align:right;">借款日期：</td>
							<td style="text-align:left;">
								<c:set target="${Timestamp}" property="time" value="${maindata.borrow.borrowingtime }"/> 
								<fmt:formatDate pattern="yyyy-MM-dd" value="${Timestamp}" type="both"/>
							</td>
						</tr>
						<tr>
							<td style="width:30%; text-align:right;">归还日期：</td>
							<td style="text-align:left;">
								<c:set target="${Timestamp}" property="time" value="${maindata.borrow.returntime }"/> 
								<fmt:formatDate pattern="yyyy-MM-dd" value="${Timestamp}" type="both"/>
							</td>
						</tr>
						<tr>
							<td style="width:30%; text-align:right;">金额：</td>
							<td style="text-align:left;">
								${maindata.borrow.money }
							</td>
						</tr>
						<tr>
							<td style="width:30%; text-align:right;">借款原因：</td>
							<td style="text-align:left;">${maindata.borrow.reason }</td>
						</tr>
						<tr>
							<td style="width:30%; text-align:right;">审批意见类型：</td>
							<td style="text-align:left;">
								<input type="radio" checked="checked" id="remarktype" name="remarktype" value="1" /><span>通过</span>&nbsp<input type="radio" id="remarktype" name="remarktype" value="2"/><span>不通过</span>
							</td>
						</tr>
						<tr>
							<td style="width:30%; text-align:right;">审批意见：</td>
							<td style="text-align:left;">
								<input type="text" id="remark" name="remark">
							</td>
						</tr>
						<tr>
							<td style="width:30%; text-align:right;">流转记录：</td>
							<td>
								<c:forEach items="${list}" var="record">
									<c:set var="time" value="${record.endtime}" scope="request"></c:set>
									
									${record.username} &nbsp;&nbsp;
									<c:if test="${record.nodesort == 1}">发起申请</c:if>
									<c:if test="${record.remarktype == 1}">已同意</c:if>
									<c:if test="${record.remarktype == 2}">不同意</c:if>
									 &nbsp;&nbsp;
									 <c:set target="${Timestamp}" property="time" value="${record.createtime }"/> 
									 <fmt:formatDate pattern="yyyy-MM-dd" value="${Timestamp}" type="both"/>
									</br>
								</c:forEach>
							</td>
								
						</tr>
						
						
						
						<tr class="content-search" style="text-align: center;">
							<td colspan="2" style="width:100%;">
								<div>
									<button style="background-color:#e8e8e8;color:#666;" type="button" onclick="closebutton();" id="output1">关闭</button>
									<a href="#" class="but_a" style="color:#fff;" onclick="handle();">办理</a>
								</div>
							</td>
						</tr>
					  </tbody>
				  </table>            
				</div>	
			</div>
	</form>
</body>
</html>
